/*
 * Copyright (c) 2005, 2014 vacoor
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 */
package org.vacoor.nothing.security.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.vacoor.nothing.web.entity.UuidEntity;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.util.Set;

/**
 * @author vacoor
 */
@Entity
@Table(name = "T_MODULE")
@JsonIgnoreProperties({"children"})
public class Module extends UuidEntity {
    private String name;
    private String value;
    private String url;
    private Integer sort;
    // desc
    // visible
    private Module parent;
    private Set<Module> children;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    @ManyToOne
    public Module getParent() {
        return parent;
    }

    public void setParent(Module parent) {
        this.parent = parent;
    }

    @OneToMany(mappedBy = "parent")
    public Set<Module> getChildren() {
        return children;
    }

    public void setChildren(Set<Module> children) {
        this.children = children;
    }
}
